package com.ziyun.pop.mall.module.user.web;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.service.goods.model.seller.SellerInfoVO;
import com.service.ucenter.constant.UcenterResult;
import com.ziyun.pop.mall.module.user.service.PopSellerInfoService;

/**
 * 个人中心的商家信息展示
 * @author husong
 *
 */
@Controller
public class SellerInfoController{
	
	private static Logger _log = LoggerFactory.getLogger(SellerInfoController.class);
	private static final String MODEL = "/user/sellerInfo";
	
	@Autowired
	private PopSellerInfoService popSellerInfoService;

	/**
	 * 商家信息显示
	 * @return
	 */
	@GetMapping(MODEL+"/index.do")
	public ModelAndView index(){
			ModelAndView view = new ModelAndView("/user/sellerInfo/index.html");
			return view;
	}
	
	/**
	 * 获取商家信息
	 * @return
	 */
	@PostMapping(MODEL+"/getSellerInfo.json")
	@ResponseBody
	public UcenterResult<SellerInfoVO> getSellerInfo(){
		SellerInfoVO sellerInfoVO = popSellerInfoService.getSellerInfoVO().getData();
		return UcenterResult.success(sellerInfoVO);		
	}

}
